import { Message } from 'element-ui'

//列表请求  data --- rows
var white_rows = [
  "jic-manager/sysRole/queryPageSysRole",
  "jic-manager/child/queryPage",
  //"jic-manager/merchant/queryMerchantList",
  "jic-manager/store/getStoreList",
  "jic-market/goods/query/queryManagerPage",
  "jic-market/lotteryActivity/queryLotteryThemeList",
  "jic-market/coupon/query-config-page",
  "jic-member/meMemberIntegralRule/queryList",
  "jic-member/mememberIntegralRuleCustomize/queryList",
  "jic-member/growthRule/getMemberGrowthRule",
  "jic-member/customizeGrowthRule/queryCustomizeGrowthRule",
  "jic-member/memberGrade/queryList",
  "jic-member/msGrowthRule/queryBaseRule",
  "jic-member/msGrowthRule/queryGrowthRule",
  "jic-member/msGrowthRule/queryPowerRule",
  "jic-member/meMemberUser/queryMemberUserList",
  "jic-member/memMemberCustomLabe/queryList",
  "jic-member/megradeRule/queryMegradeRuleList",
  "jic-member/memberVip/queryList",
  "jic-member/mevipRule/queryVipRuleList",
  "jic-member/mevipRule/queryMerchantOrStoreVipRuleList",
  "jic-member/memberGrowth/queryGrowthBaseRuleList",
  "jic-member/growthRule/getRulistByChild",
  "jic-market/PatchGrouponInstDetail/query",
  "jic-member/memberLegalRule/queryMemberLegalRuleList",
  "jic-market/template/queryPage",
  "jic-market/PatchGrouponInst/query",
  "jic-market/allocation/queryPageList",
  "jic-member/trip/queryTripList",
  "jic-member/memDiscountTheme/queryDiscountThemeList",
  "jic-market/patch-groupon-theme/query",
  "jic-manager/tTemplate/listPage",
  "jic-manager/merchant/queryMerchantList",
  "jic-market/promotion/listByPage",
  "jic-manager/merchant/queryMerchantList"
];
//列表请求  data --- list
var white_list = [
  "jic-market/promotion/listByPage",
  "jic-market/patch-groupon-theme/query",

];

export default {
  checkWhiteListUrl(url, data) {
    if (white_rows.includes(url)) {
      let load = document.createElement("div");
      load.className = "el-loading-mask";
      load.innerHTML = "<div class='el-loading-spinner'><i class='el-icon-loading' color='#fff'></i></div>";
      if (document.getElementsByClassName("el-table") && document.getElementsByClassName("el-table")[0]) {
        document.getElementsByClassName("el-table")[0].appendChild(load);
        setTimeout(function () {
          document.getElementsByClassName("el-table")[0].removeChild(load);
        }, 100)
      }
    }
    if (white_rows.indexOf(url) != -1 && (data.data.rows == null || data.data.rows.length == 0)) {
      // Message.warning({ //弹窗使用方法
      //   showClose: true,
      //   duration: 2000, //警告的消息3秒钟后消失
      //   message: "查询暂无数据",
      // });

    }
    if (white_list.indexOf(url) != -1 && (data.data.list == null || data.data.list.length == 0)) {
      // Message.warning({ //弹窗使用方法
      //   showClose: true,
      //   duration: 2000, //警告的消息3秒钟后消失
      //   message: "查询暂无数据",
      // });
    }
  }
}
